<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('采购单位验收合同列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">


            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:acceptancecontract:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:acceptancecontract:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:acceptancecontract:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:acceptancecontract:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:acceptancecontract:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:acceptancecontract:remove')}]];
        var listFlag = [[${@permission.hasPermi('system:acceptancecontract:list')}]];
        var prefix = ctx + "system/acceptancecontract";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "采购单位验收合同",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'acceptanceContractId',
                    title: '采购单位验收合同表ID',
                    visible: false
                },
                {
                    field: 'unitName',
                    title: '采购单位',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return '<a href="javascript:void(0)" onclick="detail(\'' + row.acceptanceContractId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'unitNumber',
                    title: '采购编号'
                },
                {
                    field: 'dealPrice',
                    title: '成交价(元)'
                },
                {
                    field: 'expectMoney',
                    title: '审批预算(元)'
                },
                {
                    field: 'unitManager',
                    title: '联系人'
                },
                {
                    field: 'unitTel',
                    title: '采购单位联系电话'
                },
                {
                    field: 'supplierName',
                    title: '供货商名称'
                },
                {
                    field: 'manager',
                    title: '负责人'
                },
                {
                    field: 'supplierPhone',
                    title: '供货商联系电话'
                },
                {
                    field: 'acceptanceResult',
                    title: '验收结果'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];

                        actions.push('<a class="btn btn-danger btn-xs ' + listFlag + '" href="javascript:void(0)" onclick="yulan(\'' + row.acceptanceContractId + '\')"><i class="fa fa-remove"></i>预览</a>');
                        actions.push('<a class="btn btn-info btn-xs ' + listFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.acceptanceContractId + '\')"><i class="fa fa-list-ul"></i>验收单商品</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /*验收单商品列表-详细*/
        function detail(acceptanceContractId) {
            var url = prefix + '/detail/' + acceptanceContractId;
            $.modal.openTab("验收单商品列表", url);
        }

        /**
         * 验收单预览
         * @param acceptanceContractId
         */
        function yulan(acceptanceContractId) {
            var url = prefix + '/yulan/' + acceptanceContractId;
            $.modal.openTab("验收单预览", url);
        }
    </script>
</body>
</html>